package szc.common.code.rule;

import szc.common.code.enums.CodeLineParserEnum;
import szc.common.code.enums.FileTypeEnum;

import java.util.LinkedList;
import java.util.List;

/**
 * @desc 解析器
 * @author songzc
 * @date 2022/6/18
 */
public abstract class CodeLineParserAbstract {
    //代码特征
    protected FileTypeEnum fileTypeEnum ;
    protected String codeLine = "";
    protected CodeLineParserEnum parserType;
    protected int lineCount = 0;
    protected List<IParserStatusWatcher> parseStatusWatcherGroup = new LinkedList<IParserStatusWatcher>();

    public void setCodeLine(String codeLine) {
        this.codeLine = codeLine.trim();
    }

    public abstract boolean parseCodeLine();

    public CodeLineParserEnum getParserType() {
        return this.parserType;
    }

    public int getCodeLineCount() {
        return this.lineCount;
    }

    public void addStatusWatcher(IParserStatusWatcher watcher) {
        this.parseStatusWatcherGroup.add(watcher);
    }
}
